package com.project.service;

import com.fasterxml.jackson.annotation.JsonFormat;
import dev.langchain4j.model.output.structured.Description;
import dev.langchain4j.service.UserMessage;
import lombok.Data;

import java.time.LocalDate;

/**
 * @Author: zhoujinchuan
 * @Description: （）
 * @Date: 2025/2/24 16:10
 */
public interface PersonExtractor {

    /**
     * 将文本转为对象
     * @param text
     * @return
     */
    @UserMessage("Extract information about a person from {{it}}")
    Person extractPerson(String text);

    @Data
    class Person {
        // 增加字段描述，让大模型更理解字段含义
        @Description("name of a person")
        private String name;

        @JsonFormat(pattern = "yyyy-MM-dd")
        private LocalDate birthDate;
    }

}
